package NetWork.Exercise005;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * ClassName:Server
 * Package:NetWork.Exercise001
 * Description:
 *
 * @Author:ZhangXin
 * @Create:2023/3/7-22:41
 * @Version:v1.0
 */
public class Server {
    public static void main(String[] args) throws IOException {

        //创建对象并连接端口
        ServerSocket serverSocket = new ServerSocket(1001);
        //等待客户端来连接

        while (true) {
            //等待客户端来连接
            Socket socket = serverSocket.accept();
            //开启一条线程
            //一个用户就对应服务器的一条线程
            new Thread(new MyRunnable(socket)).start();


        }


    }
}
